<?php
include_once '../action/userController.php';
include 'z_header.php';
if(!isset($_SESSION['nip'])){
    header('location:login.php');
}
?>
<div class="container">  
    <div class="row">
<div class="span7 offset3 accordion-group">
    <div class="span5">
    <form class="form-horizontal" method="post" action="">  
        <fieldset>  
            <legend>&nbsp;PENGATURAN KATA SANDI</legend> 
            <?php if(isset($berhasil)){
                            echo '<div class="alert alert-success" id="alert">'.$berhasil.'
                                              <button type="button" class="close" data-dismiss="alert" id="close">×</button></div>';
                        }
                        if(isset($error)){
                            echo '<div class="alert alert-serror" id="alert">'.$error.'
                                  <button type="button" class="close" data-dismiss="alert" id="close">×</button></div>';
                        } 
            ?>
            <div class="control-group">  
                <label class="control-label" align="left" for="pass_lama">Kata sandi lama</label>  
                    <div class="controls"> 
                        <input type="hidden" class="input-xlarge" name="nip" id="nip" value="<?php echo $_SESSION['nip'] ;?>">
                        <input type="hidden" class="input-xlarge" id="pass_lama" value="<?php echo $_SESSION['pass'] ;?>"> 
                        <input type="password" class="input-xlarge" id="kpass_lama">
                    </div>  
            </div> 
            
            <div class="control-group">  
                  <label class="control-label" for="pass">Kata Sandi Baru</label>  
                      <div class="controls">   
                          <input type="password" class="input-xlarge" name="pass" id="pass">    
                      </div>  
            </div>
            
            <div class="control-group">  
                <label class="control-label" for="kpass">Konfirmasi Kata Sandi Baru</label>  
                    <div class="controls">  
                        <input type="password" class="input-xlarge" name="kpass" id="kpass">
                    </div>  
            </div> 

            <div class="form-actions" align="right"> 
                <button type="submit" class="btn btn-primary" name="ubah_sandi">Simpan</button>  
            </div>  
        </fieldset>  
    </form>  
    </div>
</div>


<?php include_once 'z_footer.php';?>
<script type="text/javascript">
	$(document).ready(function(){
		$("#pass_lama").focus();
		});
         jQuery(function(){
                jQuery("#kpass_lama").validate({
                    expression: "if ((VAL == jQuery('#pass_lama').val()) && VAL) return true; else return false;",
                    message: "Kata sandi lama tidak sesuai"
                });
                jQuery("#pass").validate({
                    expression: "if (VAL.length > 5 && VAL) return true; else return false;",
                    message: "Kata sandi baru minimal 6 karakter"
                });
                jQuery("#kpass").validate({
                    expression: "if ((VAL == jQuery('#pass').val()) && VAL) return true; else return false;",
                    message: "Konfirmasi tidak sama dengan isian kata sandi baru"
                });

                                jQuery('.AdvancedForm').validated(function(){
                                        alert("Use this call to make AJAX submissions.");
                                });
            });
                
</script>